<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./art-template(1).js"></script>
</head>

<body>
    <div class="box"></div>
    <script id="con" type="text/html">
        <div>
            <p>{{num+10}}</p>
            <p>{{num|run|run2}}</p>
        </div>
    </script>
    <script>
        var res = {
            num: 10,
        }
        // 过滤器
        template.helper('run', function (params) {
            console.log(params);
            return params + 10
        })
        template.helper('run2', function (params) {
            console.log(params);// run 函数的返回值
            return params + 10
        })
        var str = template('con', res);
        document.querySelector('.box').innerHTML = str;
    </script>
</body>

</html>